<?php
header("Content-Type: text/html;charset=utf-8"); 
session_start();
    require_once ('../Config/conn.php"');


	$datas = $db->select("user", array(
		"id",
		"username",
		"password"
	), array(
		"id" => 1,
	));

	foreach($datas as $v)
	{
		$id = $v["id"];
		$username = $v["username"];
		$password = $v["password"];
	}



	
if($_GET['action']="login"){
	
	    if(md5($_GET['password']) == $password){
		
		 $_SESSION['id'] = $id;
         $_SESSION['username'] = $username;
		
		  echo "登陆成功！";
		  echo '<script>setTimeout(\'location="index.php"\', 3000);</script>';
		  exit;
		
		}else{
		
		  session_destroy ();
		  echo "用户名或密码不正确！";
		  echo '<script>setTimeout(\'location="login.php"\', 3000);</script>';
		  exit;
		};
	 
	}




?>